<template>
  <div class="feedback-content">
    <div class="feedback-item">
      <span class="feedback-label">线索评判</span>
      <el-radio-group 
        class="feedback-value" 
        v-model="feedbackInfo.clueJudge"
        @change="feedbackRequire = false">
        <el-radio :label="1">成案</el-radio>
        <el-radio :label="2">调查</el-radio>
        <el-radio :label="3">放弃</el-radio>
      </el-radio-group>
    </div>
    <div class="feedback-item" v-show="feedbackInfo.clueJudge === 1">
      <span class="feedback-label">案件名称</span>
      <el-input 
        class="feedback-value"
        clearable
        v-model="feedbackInfo.caseName" 
        placeholder="请输入案件名称"></el-input>
    </div>
    <div class="feedback-item" v-show="feedbackInfo.clueJudge === 1">
      <span class="feedback-label"><span>*</span>案号</span>
      <el-input 
        :class="['feedback-value', {'red': feedbackRequire && !feedbackInfo.caseNum.trim()}]"
        v-model="feedbackInfo.caseNum" 
        placeholder="请输入案号"
        clearable
        maxlength="50"></el-input>
    </div>
    <div class="feedback-item" v-show="feedbackInfo.clueJudge === 3">
      <span class="feedback-label"><span>*</span>说明</span>
      <el-input 
        clearable
        :class="['feedback-value', {'red': feedbackRequire && !feedbackInfo.explain.trim()}]"
        v-model="feedbackInfo.explain" 
        placeholder="请输入说明"
        maxlength="50"></el-input>
    </div>
  </div>
</template>
<script>
  export default {
    name: 'feedback',
    data () {
      return {
        feedbackInfo: {
          clueJudge: 1,
          caseName: '',
          caseNum: '',
          explain: ''
        },
        feedbackRequire: false,
      }
    },
    created () {
    },
    mounted() {
    },
    methods: {
      // 成案反馈确认
      feedbackDown() {
        // 可成案
        if(this.feedbackInfo.clueJudge === 1) {
          if(!this.feedbackInfo.caseNum.trim()) {
            this.feedbackRequire = true;
            this.$message.error('案号不能为空！')
            return
          }
        }
        // 放弃
        else if(this.feedbackInfo.clueJudge === 3) {
          if(!this.feedbackInfo.explain.trim()) {
            this.feedbackRequire = true;
            this.$message.error('说明不能为空！')
            return
          }
        }
        let data = {}
        if (this.feedbackInfo.clueJudge === 1) {
          data = {
            evaluationResult: this.feedbackInfo.clueJudge,
            ajmc: this.feedbackInfo.caseName,
            bmsah: this.feedbackInfo.caseNum
          }
        } else if (this.feedbackInfo.clueJudge === 2) {
          data = {
            evaluationResult: this.feedbackInfo.clueJudge
          }
        } else if (this.feedbackInfo.clueJudge === 3) {
          data = {
            evaluationResult: this.feedbackInfo.clueJudge,
            info: this.feedbackInfo.explain
          }
        }
        this.$emit('feedbackDown', data)
      }
    }
  };
</script>
<style lang="scss" scoped>
  .feedback-content {
    width: 100%;
    height: 158px;
    color: #535C68;
    line-height: 24px;
    font-size: 14px;
    .feedback-item {
      margin-bottom: 16px;
      .feedback-label {
        display: inline-block;
        width: 68px;
        padding-right: 12px;
        text-align: right;
        span {
          color: #ED5861;
          display: inline-block;
          margin-right: 5px;
        }
      }
      .feedback-value {
        width: 364px;
      }
    }
  }
</style>




